/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.lczyfz.wisdom.modules.platform.vueweb;

import com.lczyfz.wisdom.common.utils.ServerResponse;
import com.lczyfz.wisdom.common.web.BaseController;
import com.lczyfz.wisdom.modules.platform.entity.PUser;
import com.lczyfz.wisdom.modules.platform.service.PUserService;
import com.lczyfz.wisdom.modules.platform.wxutils.SmsUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * puserController
 * @author css
 * @version 2019-09-26
 */

@Api(value = "user",description = "用户接口")
@RestController
@RequestMapping(value = "${apiPath}/puser/pUser")
public class VuePUserController extends BaseController {

	@Autowired
	private PUserService pUserService;
	
	/**
	 * 用户注册
	 * @param pUser
	 * @return
	 */
	@ApiOperation(value = "用户注册",httpMethod = "POST")
	@RequestMapping(value = "puserSave",method = RequestMethod.POST)
	public ServerResponse puserSave(@RequestBody PUser pUser) {
		return pUserService.savePuser(pUser);
	}

	/**
	 * 获取短信验证码
	 * @param mobile
	 * @return
	 */
	@ApiOperation(value = "获取短信验证码",notes = "-1：获取电话异常",httpMethod = "GET")
	@RequestMapping(value = "getVerifyCode",method = RequestMethod.GET)
	public ServerResponse getVerifyCode(@RequestParam(value = "mobile")String mobile){
		SmsUtils smsUtils = new SmsUtils();
		if(null == mobile || "".equalsIgnoreCase(mobile)){
			return new ServerResponse(-1,"请填写用户电话号码");
		}
		ServerResponse response = smsUtils.sendMessage(mobile);
		return response;
	}

	//todo 修改密码



}